ERROR: Formula failed: Formula set-attribute: Not allowed to set `id` attribute.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmanovRu
    Junior Member
    • Jun 2019
    • 11

    ERROR: Formula failed: Formula set-attribute: Not allowed to set `id` attribute.

    After installing update 7.1.0. formula has stopped working. Entity contact.

    Formula example:
    ifThen(
    entity\isNew(),
    id = newphoneNumber
    );


    ERROR: Workflow[628cae3704800b759]: Action failed [updateEntity] with cid [0], details: Formula set-attribute: Not allowed to set `id` attribute..
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Why do you set id in the formula. There should not be a reason to do that. Your formula breaks the logic of the application and the new fix prevents this. It's not a bug. The error message explains what is happened. No reason to create a bug report.
    Last edited by yuri; 05-24-2022, 11:24 AM.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • AmanovRu
      Junior Member
      • Jun 2019
      • 11

      #3
      Is there any way to disable this feature in my case? We use the customer's phone number as the contact ID.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8453

        #4
        I recommend to have this logic in a beforeSave hook.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • AmanovRu
          Junior Member
          • Jun 2019
          • 11

          #5
          I have a very big request, we have been working in this system with the current logic for three years, if you have time, find an opportunity to fix it. I had to roll back the system, but I would hate to miss updates.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8453

            #6
            This is not a bug so won't be fixed.
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • AmanovRu
              Junior Member
              • Jun 2019
              • 11

              #7
              very sorry to hear that

              Comment

              • yuri
                Member
                • Mar 2014
                • 8453

                #8
                You can do the same in a before-save hook. https://docs.espocrm.com/development/hooks/

                Or create a custom formula function that changes the ID https://github.com/espocrm/documenta...-in-formula.md

                We can't allow setting ID from the formula as it's a breaking of the application logic.
                Last edited by yuri; 05-25-2022, 07:03 AM.
                If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                Comment

                Working...